package operations;

import agent.State;

public class SailRight implements Operation{

	@Override
	public State exec(State nod) {
		if (!validOperation(nod))
			return null;
		State ret = nod.dupe();
		ret.setBoatRight(true);
		ret.setBoatLeft(false);

		return ret;
	}

	@Override
	public boolean validOperation(State nod) {
		if (!nod.isBoatLeft())
			return false;
		if ((nod.isCabadgeLeft() && nod.isGoatLeft()) ||
			(nod.isWolfLeft() && nod.isGoatLeft()))
			return false;
		return true;
	}

}
